    TplMgr = {
        
        NewFile : function() {
            editAreaLoader.setValue('code', '');
            $('editor').show();
            $('new_file_div').show();
            
        },
            
        LoadFile : function(file_path) {
            new Ajax.Request(Settings.Host + '?controller=admin&method=tpl_mgr_load_file_ajax', {
                parameters : { file : file_path },
                onLoading : function() {
                    $('corner_loader').toggle();
                    $('error_bar').hide();
                    $('new_file_div').hide();
                    $('new_file_name').value = '';
                },
                onSuccess : function(transport)
                {
                    $('corner_loader').toggle();
                    json = transport.responseText.evalJSON(true);
                    
                    if(json['status'] == false)
                    {
                        $('error_bar').update("Can't load file: " + json['content']);
                        $('error_bar').show();
                        $('editor').hide();
                    } else {
                        
                        $('editor').show();
                        
                        $('file_is_loaded').value = file_path;
                        
                        editAreaLoader.setValue('code', json['content']);
                    }
                }
            });
        },
        
        SaveFile : function() {
            
            new_file_name = $('new_file_name').value;
            
            if(new_file_name !== "")
            {
                file_name = $('file_is_loaded').value = 'NEW|' + new_file_name;
            } else {
                file_name = $('file_is_loaded').value;
            }
            
            new Ajax.Request(Settings.Host + '?controller=admin&method=tpl_mgr_save_file_ajax', {
                parameters : { file : file_name , content : editAreaLoader.getValue('code') },
                onLoading : function() {
                    $('corner_loader').toggle();
                    $('error_bar').hide();
                },
                onSuccess : function(transport) {
                    $('corner_loader').toggle();
                    json = transport.responseText.evalJSON(true);
                    
                    if(json['status'] == false)
                    {
                        $('error_bar').update(json['content']);
                        $('error_bar').show();
                        $('editor').hide();
                    } else {
                        $('new_file_name').value = '';
                        $('success_bar').update(json['content']);
                        $('success_bar').show();
                        setTimeout('new Effect.toggle(\'success_bar\', \'Appear\', {duration:3});', 1000);
                    }
                }
            });
            
        },
        
        Init : function() {
            editAreaLoader.init({
                id : "code", syntax: "html", start_highlight: true, language : "de", word_wrap : true, min_width : 735, min_height : 450
            });
        }
            
    };


    ListPages = {
            
        Change : function(container) {
            new Ajax.Request(Settings.Host + '?controller=admin&method=change_list', {
                parameters : Sortable.serialize(container.id),
                onLoading : function () {
                    $('corner_loader').toggle();
                },
                onSuccess : function (transport) {
                    json = transport.responseText.evalJSON(true);
                    
                    if(json['status'] == true)
                    {
                        /* Backend.Console(json['message']); */
                    } else {
                        Backend.Console('error listpages: ' + json['message']);
                        alert(json['message']);
                    }
                    $('corner_loader').toggle();
                }
            });
        }
    };
    
    /* ADMIN AJAX LOADER */
    
    Ax = {
        
        submit_method : 'get',
        
        submit_params : '',
        
        update_container : false,
        
        Get : function(url) {
            
            this.submit_method = 'get';
            
            this.submit_params = url.toQueryParams();
            
            return this;
        },
        
        Post : function(form_obj) {
            
            this.submit_method = 'post';
            
            this.submit_params = $(form_obj).serialize(true);
                
            return this;
        },
        
        Container : function(div)
        {
            this.update_container = div;
            return this;
        },
        
        
        Request : function(method, highlight_div) {
            
            new Ajax.Request(Settings.Host + '?controller=admin&method=' + method, {
                
                parameters : this.submit_params, 
                
                method : this.submit_method,
                
                onLoading : function() { 
                    $('corner_loader').show();
                }, 
                
                onSuccess : function(transport) {
                    
                    $('corner_loader').hide();
                    
                    transp = transport.responseText;
                    
                    
                    if(transp.isJSON())
                    {
                        json = transport.responseText.evalJSON(true);
                    } else {
                        $('dynamic_content').update('<div class="false">Der geladene Inhalt enthaltet einen Fehler. Der Debugger wird geladen ...</div>');
                        BkLoader.Debuging('dynamic_content', transp);
                        return false;
                    }
                    
                    if(json['status'] == true)
                    {
                        if(highlight_div !== undefined)
                        {
                            new Effect.Highlight(highlight_div, {startcolor:'#0f8511'});
                        }
                    } else {
                        alert('error while doing async request! please try again later.');
                    }
                    /* this.Reset(); */
                }
            });
            
            this.Reset();
        },
        
        Reset : function() {
            this.submit_method = 'get';
            this.submit_params = '';
            this.update_container = false;
        }
    };
    
    /* backend check availability */
    
    
    
    /* GLOBAL BACKEND LOADER */
    
    BkLoader = {
        
        submit_method : 'get',
            
        submit_params : '',
        
        Get : function(url) {
        
            this.submit_method = 'get';
            
            this.submit_params = url.toQueryParams();
        
            /* Backend.Console('BkLoader changed to Get'); */
            
            return this;
        },
        
        Post : function(form_obj) {
            
            this.submit_method = 'post';
            
            this.submit_params = $(form_obj).serialize(true);
            
            /* Backend.Console('BkLoader changed to Post'); */
                
            return this;
        },
        
        Init : function() {
        
			vars = window.location.hash;
		
			/*
			 * new loader with multiple params
			 */
		
            var xuri = vars.replace("#","").toQueryParams();
			
			var loader = '';
			var params = '';
			
			for (var item in xuri) {
				
				if(typeof item !== 'string') continue;
				
				if(item == "ajax")
				{
					var loader = xuri[item];
				} else {
					params = params + item + "=" + xuri[item] + "&";
				}
			}
			
			if(loader == '')
			{
				this.Load('dashboard');
			} else {
				if(params == '')
				{
					this.Load(loader);
				} else {
					this.Get(params).Load(loader);
				}
			}
        },
        
        Load : function(callback_action) {
            
            new Ajax.Request(Settings.Host + '?controller=admin&method=request_method&name=' + callback_action, {
                
                parameters : this.submit_params,
                
                method : this.submit_method,
                
                onLoading : function () {
                
                    $('corner_loader').show();
                },
                
                onSuccess : function (transport) {
                    
                    $('corner_loader').hide();
                    
                    transp = transport.responseText;
                    
                    if(transp.isJSON())
                    {
                        json = transport.responseText.evalJSON(true);
                    } else {
                        $('dynamic_content').update('<div class="false">Der geladene Inhalt enthaltet einen Fehler. Der Debugger wird geladen ...</div>');
                        BkLoader.Debuging('dynamic_content', transp);
                        Backend.Console('error while loading ' + callback_action + ', see the log files during this time');
                        return false;
                    }
                    
                    if(json['error'] == false)
                    {
                        $('dynamic_content').update(json['source']);
                        document.title = 'Administration - ' + json['page_title'];
                    } else {
                        $('dynamic_content').update('<div class="false">Fehler beim Laden des Inhalts</div>');
                        BkLoader.Debuging('dynamic_content', json['source']);
                        Backend.Console('error while loading ' + callback_action + ', see the log files');
                    }

                    this.submit_params = null;
                    
                }
            });
        },
        
        Debuging : function(container_object, response_text) {
            new Ajax.Request(Settings.Host + '?controller=admin&method=debug_method_content', {
                parameters : { response_text : response_text },
                onSuccess : function(transport) {
                    $(container_object).insert('<div class="block px12 padding5" style="line-height:22px; color:white;">' + transport.responseText + '</div>');
                }
            });
        }
    };
    
    document.observe('dom:loaded', BkLoader.Init());
    
    /* GLOBAL STUFF */

    Backend = {
            
        CheckAll : function(class_select)
        {
            $$('.' + class_select).each(function(item){
                if(item.checked == true)
                {
                    item.checked = false;
                } else {
                    item.checked = true;
                }
            });
        },
            
        Reload : function() {
            location.reload();
        },
            
        CheckStemp : function() {
            new Ajax.Request(Settings.Host + '?controller=admin&method=check_stemp', {
                onSuccess : function(transport) {
                    json = transport.responseText.evalJSON(true);
                    
                    if(json['is_valid'] == true)
                    {
                        setTimeout('Backend.CheckStemp();', 60000);
                    } else {
                        alert('your session key is not valid anymore! u have to login again!');
                    }
                }
            });
        },
            
        Confirm : function(title) {
        
            check = confirm("Den Eintrag " + title + " wirklich entfernen?");
        
            if(check == false) return false;
        
        },
        
        navOver : function (id) {
            $('ov_' + id).toggle();
        },
        
        Console : function (message) {
            var jetzt = new Date();
            var Std = jetzt.getHours();
            var Min = jetzt.getMinutes();
            var Sek = jetzt.getSeconds();
            var StdAusgabe = ((Std < 10) ? "0" + Std : Std);
            var MinAusgabe = ((Min < 10) ? "0" + Min : Min);
            var SekAusgabe = ((Sek < 10) ? "0" + Sek : Sek);
            var elmn = new Element("p").update(StdAusgabe + ':' + MinAusgabe + ':' + SekAusgabe + ' - ' + message);
            
            $('console').insert({ 'top' : elmn });
            
            new Ajax.Request(Settings.Host + '?controller=admin&method=async_history', {
                parameters : { message : message }
            });
        },
        
        CheckRwName : function (field_object, submit_bt, default_value) {
            field = $(field_object);
            new Ajax.Request(Settings.Host + '?controller=admin&method=check_rewrite', {
                parameters : { name : field.value },
                onSuccess : function(transport) {
                    json = transport.responseText.evalJSON(true);
                    
                    if(json['free'] == true || field.value == default_value)
                    {
                        if(!$(field_object).hasClassName('field_true'))
                        {
                            $(field_object).toggleClassName('field_false');
                            $(field_object).toggleClassName('field_true');
                        }
                        $(submit_bt).disabled = false;
                    } else {
                        if(!$(field_object).hasClassName('field_false'))
                        {
                            $(field_object).toggleClassName('field_false');
                            $(field_object).toggleClassName('field_true');
                        }
                        $(submit_bt).disabled = true;
                    }
                }
            });
        }
        
    };
    
    document.observe('dom:loaded', Backend.CheckStemp());
    

    /* PAGE EDIT */
    
    PageEdit = {
        
        init : function() {
            ydtab_load();
        },
        
        newMCE : function(id) {
            
            csl = tinyMCE.init({
                mode : 'none',
                theme : 'advanced',
                theme : "advanced",
                theme_advanced_blockformats : "h1,h2,h3,p",
                theme_advanced_buttons1 : "bold,italic,underline,separator,link,unlink,separator,bullist,numlist,separator,undo,redo,separator,formatselect,code,cleanup",
                theme_advanced_buttons2 : "",
                theme_advanced_buttons3 : "",
                theme_advanced_toolbar_location : "top",
                theme_advanced_toolbar_align : "center",
                theme_advanced_statusbar_location : "bottom",
                height:"400px", width:"740px", convert_urls : false, cleanup_on_startup : true
            });
            
            tinyMCE.execCommand("mceAddControl", true, id);
        },
        
        Submit : function(form, lang_id) {  
            
            tinyMCE.triggerSave();
        
            new Ajax.Request(Settings.Host + '?controller=admin&method=edit_page_ajax', {
                
                parameters : $(form).serialize(true),
            
                onLoading : function() {
                    $('corner_loader').show();
                },
                
                onSuccess : function(transport) {
                    
                    $('corner_loader').hide();
                    
                    json = transport.responseText.evalJSON(true);
                    
                    if(json['status'] == "false")
                    {
                        alert('Fehler: ' + json['message']);
                        
                        new Effect.Highlight('content_frame_' + lang_id, {startcolor:'#850f1a', endcolor:'#a7565d', restorecolor:'#a7565d'});
                        
                        Backend.Console('Page edit error: ' + json['message']);
                        
                    } else {
                        new Effect.Highlight('content_frame_' + lang_id, {startcolor:'#0f8511', endcolor:'#525E72', restorecolor:'#525E72'});
                        
                        $('cv_' + json['block']['language_id']).value = json['block']['nav_id'];
                        
                        Backend.Console('Page "' + json['block']['title'] + '" edited with response status: ' + json['status']);
                    }
                    
                    
                }
                
            });
        
        },
        
        Properties : function(form) {
            
            new Ajax.Request(Settings.Host + '?controller=admin&method=edit_prop_ajax', {
                
                parameters : $(form).serialize(true), 
                
                onSuccess : function(transport) {
                
            		json = transport.responseText.evalJSON(true);
            	
                    if(json['error'] === false)
                    {
                        new Effect.Highlight('sysprop', {startcolor:'#0f8511', endcolor:'#3C4654', restorecolor:'#3C4654'});
                    } else {
                        new Effect.Highlight('sysprop', {startcolor:'#850f1a', endcolor:'#a7565d', restorecolor:'#a7565d'});
                        Backend.Console('error while chaning page properties!');
                    }
                    
                }
                
            });
            
        },
        
        GetVersions : function(nav_id, lang_id, mce_id, block_id)
        {
			if(block_id == "")
			{
				alert('Diese Seite wurde noch nicht erstellt und hat somit keine Versionen.');
				return false;
			}
			
            var mce_content = tinyMCE.get(mce_id).getContent();
            
            nav_id = $(nav_id).value;
            
            if(nav_id == "")
            {
                alert("no version for a not added page available!");
                return false;
            }
            
            new Ajax.Request(Settings.Host + '?controller=admin&method=get_block_versions', {
                
                parameters : { 'nav_id' : nav_id , 'lang_id' : lang_id , 'mce_id' : mce_id },
                
                onLoading : function() {
                    $('corner_loader').show();
                },
                
                onSuccess : function(transport) {
                    
                    $('corner_loader').hide();
                    
                    $('versions_' + lang_id).show();
                    
                    $('versions_' + lang_id).update(transport.responseText);
                }
                
            });
        },
        
        VersionCompareInsert : function(block_version_id, mce_id)
        {
            new Ajax.Request(Settings.Host + '?controller=admin&method=set_block_version', {
                
                parameters : { mce_id : mce_id , block_version_id : block_version_id } ,
                
                onLoading : function() {
                    $('corner_loader').show();
                },
                
                onSuccess : function(transport) {
                    Backend.Console('loaded old version into editor; block_version_id: ' + block_version_id + '; mce_id: ' + mce_id);
                    $('corner_loader').hide(); /* $('versions').hide(); */
                    tinyMCE.get(mce_id).setContent(transport.responseText);
                    fb.close();
                }
            });
        },
        
        UserRightsLoad : function (nav_id)
        {
            new Ajax.Request(Settings.Host + '?controller=admin&method=get_user_rights', {
                    parameters : { nav_id : nav_id },
                    onLoading : function() {
                        $('user-rights-loader').toggle();
                    },
                    onSuccess : function(transport)
                    {
                        $('user-rights-loader').toggle();
                        $('user-rights-container').update(transport.responseText);
                    }
            });
        },
        
        UserRightsSet : function (nav_id)
        {
            var xhash = new Hash(); 
            
            $$('.setthisusers').each(function(element){
                if($(element).checked)
                {
                    xhash.set($(element).value, $(element).value);
                }
            });
            
            new Ajax.Request(Settings.Host + '?controller=admin&method=set_user_right&nav_id=' + nav_id, {
                parameters : xhash.toObject(),
                onLoading : function() {
                    $('user-rights-loader').toggle();
                },
                onSuccess : function(transport) {
                    $('user-rights-loader').toggle();
                    PageEdit.UserRightsLoad(nav_id);
                }
            });
        },
		
		EnvLoad : function (block_id)
		{
			if(typeof block_id == 'undefined')
			{
				alert('Diese Seite wurde noch nicht erstellt und kann somit keine Variablen enthalten');
				return false;
			}
			
			Effect.toggle('envvars_' + block_id, 'slide');
			
			new Ajax.Request(Settings.Host + '?controller=admin&method=get_env_vars&block_id=' + block_id, {
				onSuccess : function(transport)
				{
					$('envvars-container-' + block_id).update(transport.responseText);
				}
			});
		},
		
		EnvSave : function (form_id, block_id)
		{
			new Ajax.Request(Settings.Host + '?controller=admin&method=set_env_vars&block_id=' + block_id, {
				parameters : $(form_id).serialize(true),
				onSuccess : function(transport)
				{
					json = transport.responseText.evalJSON(true);
					
					if(json['error'] === false)
					{
						new Effect.Highlight('envvars-container-' + block_id, {startcolor:'#0f8511', endcolor:'#626c7e'});
					} else {
						new Effect.Highlight('envvars-container-' + block_id, {startcolor:'#850f1a', endcolor:'#626c7e', });
                        Backend.Console('error while updating env variables.');
					}
				}
			})
		}
        
    };
    
    /* PAGE ADD - ADD PAGE */

    AddPage = {
            
        LoadNav : function() {
        
            new Ajax.Request(Settings.Host + '?controller=admin&method=add_page_loadnav_ajax', {
                
                parameters : { cat_rw : $F('cat_field') },
                
                onLoading : function() {
                    
                    $('corner_loader').show();
                    
                },
                
                onSuccess : function(transport) {
                    
                    $('corner_loader').hide();
                    
                    var json = transport.responseText.evalJSON(true);
                    
                    select = new Element("option", { value : 0 }).update('Root');
                    
                    $('parent_field').update(select);
                    
                    for(var item in json)
                    {
                        if(typeof json[item] !== 'object') continue;
                        
                        node = new Element("option", { 'value' : json[item]['id'] }).update('- ' + json[item]['title']);
                        $('parent_field').insert(node);
                        
                        /* ADD SUBS */
                        
                        for(var sub in json[item]['sub'])
                        {
                            if(typeof json[item]['sub'][sub] !== 'object') continue;
                            
                            node = new Element("option", { 'value' : json[item]['sub'][sub]['id'] }).update('&nbsp;&nbsp;&nbsp;&nbsp;- ' + json[item]['sub'][sub]['title']);
                            $('parent_field').insert(node);
                            
                        }
                        
                    }
                }
                
            });
        
        }
            
    };

    /* DEVMOD JS STUFF */

    DevMod = {
        
        FormContainer : 'frm_container',
        
        AddField : function() {
        
            elemn = new Element("div", {}).update(
                '<table><tr><td colspan="2" style="padding:0px;">Fieldname</td></tr><tr><td style="padding:0px;"><input type="text" class="text" name="fields[]" value="">'+
                '</td><td><select name="type[]"><option value="int">INT</option><option value="varchar">VARCHAR (255)</option><option value="text">Text</option><option value="pk">PRIMARY KEY A.I</option></select>'+
                '</td></tr></table>'
            );
            
            $(DevMod.FormContainer).insert(elemn);
        
        }
    };
    
    /* DEVMOD IMPORT FILE UPP */
 
     FileUppDM = {
            
        Stop : function(status, message) {
            
			Backend.Console('File upload finished; status: ' + status);
            
            $('file_loader').hide();
            
            $('log').update(message);
            
            if(status == true)
            {
                new Effect.Highlight('file_uploader_container', {startcolor:'#0f8511', endcolor:'#525E72', restorecolor:'#525E72'});
            } else {
                new Effect.Highlight('file_uploader_container', {startcolor:'#850f1a', endcolor:'#a7565d', restorecolor:'#a7565d'});
            }
        },
            
        Start : function() {
            $('file_loader').show();
        }
            
    };
    
    FileUpp = {
            
        Stop : function(status, message, nav_id) {
            
			Backend.Console('File upload finished; status: ' + status);
            
            $('file_loader').hide();
           
		   console.log(nav_id);
		   
            if(status == true)
            {
                new Effect.Highlight('file_uploader_container', {startcolor:'#0f8511', endcolor:'#525E72', restorecolor:'#525E72'});
				FileList.Load(nav_id);
            } else {
                new Effect.Highlight('file_uploader_container', {startcolor:'#850f1a', endcolor:'#a7565d', restorecolor:'#a7565d'});
            }
        },
            
        Start : function() {
            $('file_loader').show();
        }
            
    };
 

	/* NEW FILEUPP ONLY FOR PAGE_EDIT? */
	
	/* HANDLE PAGE FILES */
	
	FileList = {
		
		Load : function(nav_id){
			
			new Ajax.Request(Settings.Host + '?controller=admin&method=list_file_ajax', {
				
				parameters : { nav_id : nav_id },
                
                onLoading : function() {
                    /* Backend.Console('loading image list for nav_id: ' + nav_id); */
                },
                
                onSuccess : function(transport) {
					
					$('file_container').update(transport.responseText);
						
				}
			});
		}
		
	};

    /* HANDLE_IMAGE */

    ImageUpp = {
            
        Stop : function(status, message, nav_id, image_container) {
            
			Backend.Console('Image upload finished; status: ' + status + '; message: ' + message);
            
			$('image_loader').hide();
            
            if(status == true)
            {
                if(nav_id !== 0)
                {
                    new Effect.Highlight('image_uploader_container', {startcolor:'#0f8511'});
                    ImageList.Load(nav_id, image_container);
                }
            } else {
                new Effect.Highlight('image_uploader_container', {startcolor:'#a7565d'});
                $('image_upp_error').update(message);
                $('image_upp_error').show();
            }
        },
            
        Start : function() {
            $('image_loader').show();
            $('image_upp_error').hide();
        }
            
    };
    
    ImageList = {
        
        Delete : function(bild_id)
        {
            check = confirm("Dieses Bild wirklich Entfernen?");
            
            if(check == false) return false;
            
            new Ajax.Request(Settings.Host + '?controller=admin&method=delete_image_ajax', {
                
                parameters : { bild_id : bild_id },
                
                onSuccess : function(transport)
                {
                    json = transport.responseText.evalJSON(true);
                    
                    if(json['status'] == true)
                    {
                        $('imgdiv_' + bild_id).hide();
                    }
                }
                
            });
        },
        
        Insert : function(bild_id)
        {
                /* find active tinyID */
                
                var tiny = tabber.getTab();
                
                html = '[photo ' + bild_id + ']';
                
                $$('#'+tiny.id+' textarea').each(function(olmn){
                     tinyMCE.execInstanceCommand(olmn.id,"mceInsertContent",false, html);
                });
        },
            
        Load : function(nav_id, image_container) {
        
            new Ajax.Request(Settings.Host + '?controller=admin&method=list_image_ajax', {
                
                parameters : { nav_id : nav_id },
                
                onLoading : function() {
                    /* Backend.Console('loading image list for nav_id: ' + nav_id); */
                },
                
                onSuccess : function(transport) {
                
                    $(image_container).update('');
                    
                    json = transport.responseText.evalJSON(true);
                    
                    for(var item in json)
                    {
                        if(typeof json[item] !== 'object') continue;
                        
                        c1 = '';
                        c2 = '';
                        c3 = '';
                        
                        switch(json[item]['layout'])
                        {
                            case "1" : c1 = 'checked="checked"'; break;
                            case "2" : c2 = 'checked="checked"'; break;
                            case "3" : c3 = 'checked="checked"'; break;
                        }
                        
                        var vals = {
                            id: json[item]['id'],
                            bild: Settings.Host + Settings.Image + json[item]['name'] + '_portrait.' + json[item]['mime'],
                            text: json[item]['text']
                        };
                        
                        var template = new Template(
                            '<div class="spacer">'+
                            '<form action="#" onsubmit="ImageList.UpdateImage(this); return false;" method="post">' +
                            '<div style="position:absolute;"><div class="closing" style="display:none;" onclick="ImageList.Delete(#{id})"></div></div>' +
                            '<div class="links">' +
                                '<div class="image" onclick="ImageList.Insert(#{id})" style="background-image:url(#{bild})"><div class="imagename">[photo #{id}]</div></div>'+
                                '<div class="linetxt"><textarea name="text">#{text}</textarea></div>'+
                            '</div>'+
                            '<div class="rechts">' +
                                    '<table class="aligns">'+
                                    '<tr><td><input type="radio" name="float" value="1" ' + c1 +' /></td><td><div class="select_left"></div></td><td>Links Ausrichten</td></tr>' +
                                    '<tr><td><input type="radio" name="float" value="2" ' + c2 +' /></td><td><div class="select_p"></div></td><td>Zentriert</td></tr>' +
                                    '<tr><td><input type="radio" name="float" value="3" ' + c3 +' /></td><td><div class="select_right"></div></td><td>Rechts Ausrichten</td></tr>' +
                                    '</table>'+
                                    
                                    '<div class="btsend"><input type="submit" name="update_image" value="Speichern" class="submit" /></div>' +
                                    
                            '</div>' +
                            '<input type="hidden" name="image_id" class="imgrid" value="#{id}" />' +
                            '</form>' +
                            '</div>'
                        );
                        
                        node = new Element("div", {'class' : 'image_item' , 'id' : 'imgdiv_'+json[item]['id']}).update(template.evaluate(vals));
                        
                        Event.observe(node, 'mouseover', function() {  
                            $$('#'+this.id+' .closing').each(function(elmn){
                                elmn.show();
                            });
                        });
                        
                        Event.observe(node, 'mouseout', function() {  
                            $$('#'+this.id+' .closing').each(function(elmn){
                                elmn.hide();
                            });
                        });
                        
                        
                        
                        $(image_container).insert(node);
                    }

                }
                
            });
        },
        
        UpdateImage : function(form_obj) {
            new Ajax.Request(Settings.Host + '?controller=admin&method=update_image_ajax', {
                
                parameters : $(form_obj).serialize(true),
                
                onLoading : function() {
                    
                },
                
                onSuccess : function(transport) {
                    
                    json = transport.responseText.evalJSON(true);
                    
                    if(json['status'] == true)
                    {
                        new Effect.Highlight('imgdiv_' + json['image_id'], {startcolor:'#0f8511'});
                        Backend.Console('new image properties saved for image id: ' + json['image_id']);
                    } else {
                        new Effect.Highlight('imgdiv_' + json['image_id'], {startcolor:'#a7565d'});
                        Backend.Console('error while saving image properties for image id: ' + json['image_id']);
                    }
                }
            });
        }
    
    };